#!/usr/bin/perl -w
print "Which directory? (Default is your home directory)";
chomp(my $dir=<STDIN>);
if ($dir =~ /\A\s*\z/){
    chdir or die"Can't chdir to your home directory: $!";
} else {
    chdir $dir or die "Can't chdir to '$dir':$!";
}

opendir DOT,"." or die "Can't opendir dot:$!";
foreach(sort readdir DOT){
    next if /\A\./; ## 如果跳过文件名以点号开头的文件 
    print "$_\n";
}
